export default function quickSort(arr: number[]): number[] {
  if (arr.length < 2) return arr;
  let pivot = arr[arr.length - 1];
  let leftArr = arr.filter((item, index) => {
    return index !== arr.length - 1 && item <= pivot;
  });
  let rightArr = arr.filter((item, index) => {
    return index !== arr.length - 1 && item > pivot;
  });
  return [...quickSort(leftArr), pivot, ...quickSort(rightArr)];
}
